Imports Microsoft.VisualBasic

Public Class OrderDetail
    Inherits BaseEntity

    Private _OrderID As String
    Public Property OrderID() As String
        Get
            Return _OrderID
        End Get
        Set(ByVal value As String)
            _OrderID = value
        End Set
    End Property

    Private _ProductID As String
    Public Property ProductID() As String
        Get
            Return _ProductID
        End Get
        Set(ByVal value As String)
            _ProductID = value
        End Set
    End Property


    Private _CostPrice As Double
    Public Property CostPrice() As Double
        Get
            Return _CostPrice
        End Get
        Set(ByVal value As Double)
            _CostPrice = value
        End Set
    End Property

    Private _Quantity As Integer
    Public Property Quantity() As Integer
        Get
            Return _Quantity
        End Get
        Set(ByVal value As Integer)
            _Quantity = value
        End Set
    End Property

    Private _ProductionDate As DateTime
    Public Property ProductionDate() As DateTime
        Get
            Return _ProductionDate
        End Get
        Set(ByVal value As DateTime)
            _ProductionDate = value
        End Set
    End Property

    Private _ExpiredDate As DateTime
    Public Property ExpiredDate() As DateTime
        Get
            Return _ExpiredDate
        End Get
        Set(ByVal value As DateTime)
            _ExpiredDate = value
        End Set
    End Property

    Public Overrides Function ToString() As String
        Dim buf As String = Me.ID & ", " & Me.OrderID & ", " & Me.ProductID & ", " & Me.CostPrice & ", " & Me.Quantity & ", " & Me.ProductionDate & ", " & Me.ExpiredDate
        buf &= MyBase.ToString()
        Return buf
    End Function

    Public Overloads Function compareAndGetDiff(ByVal _NewObj As OrderDetail) As String
        Dim buf As String = ""
        If Me.OrderID <> _NewObj.OrderID Then
            buf &= "OrderID=" & Me.OrderID & " -> " & _NewObj.OrderID & " "
        End If

        If Me.ProductID <> _NewObj.ProductID Then
            buf &= ", ProductID=" & ProductID & " -> " & _NewObj.ProductID & " "
        End If

        If Me.CostPrice <> _NewObj.CostPrice Then
            buf &= ", CostPrice=" & CostPrice & " -> " & _NewObj.CostPrice & " "
        End If

        If Me.Quantity <> _NewObj.Quantity Then
            buf &= ", Quantity=" & Quantity & " -> " & _NewObj.Quantity & " "
        End If

        If Me.ProductionDate <> _NewObj.ProductionDate Then
            buf &= ", ProductionDate=" & ProductionDate & " -> " & _NewObj.ProductionDate & " "
        End If

        If Me.ExpiredDate <> _NewObj.ExpiredDate Then
            buf &= ", ExpiredDate=" & ExpiredDate & " -> " & _NewObj.ExpiredDate & " "
        End If

        buf &= MyBase.compareAndGetDiff(_NewObj)
        Return buf
    End Function
End Class

